import 'dart:io';

import 'package:dart_vlc/dart_vlc.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:palyer/app/core/values/colors.dart';
import 'package:palyer/app/core/values/themes.dart';
import 'package:palyer/global.dart';
import 'package:palyer/router/app_pages.dart';
import 'package:window_manager/window_manager.dart';

void main() async {
  await Global.init();
  if(Platform.isWindows || Platform.isMacOS || Platform.isLinux) {
    DartVLC.initialize();
    WidgetsFlutterBinding.ensureInitialized();
    // Must add this line.
    await windowManager.ensureInitialized();

    const WindowOptions windowOptions = WindowOptions(
      // size: const Size(600, 400),
      center: true, // 居中
      // fullScreen: true,
      backgroundColor: AppColors.primary_color, // 背景色
      // skipTaskbar: true,
      titleBarStyle: TitleBarStyle.normal,  // 隐藏标题栏
      skipTaskbar: false, // 隐藏任务栏图标
    );
    windowManager.waitUntilReadyToShow(windowOptions, () async {
      await windowManager.show();
      await windowManager.setIcon('assets/image/Kiss_me.ico');
      await windowManager.setTitle('Kiss me');
    });
  }

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
            debugShowCheckedModeBanner: false,
            theme: appThemeData,
            //要处理到未定义路线的导航（404错误），可以在GetMaterialApp中定义unknownRoute页面。
            // unknownRoute: GetPage(name: '/notfound', page: () => UnknownRoutePage()),
            initialRoute: AppPages.initial,
            getPages: AppPages.routes,
          );
  }
}


